package com.zaimokuza.cn.entity.response;

import com.zaimokuza.cn.entity.enums.CustomizeExceptionEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * Controller返回对象
 *
 * @author zaimokuza
 */
@ApiModel("请求响应对象")
@Data
@AllArgsConstructor
public class ResponseEntity {

    @ApiModelProperty("状态码")
    private Integer resultCode;

    @ApiModelProperty("调用是否成功")
    private Boolean isSuccess;

    @ApiModelProperty("请求响应数据")
    private Object resultData;

    @ApiModelProperty("提示信息")
    private String resultMsg;

    public ResponseEntity(CustomizeExceptionEnum customizeExceptionEnum) {
        this.resultCode = customizeExceptionEnum.getResultCode();
        this.isSuccess = customizeExceptionEnum.getIsSuccess();
        this.resultMsg = customizeExceptionEnum.getResultMsg();
    }

    public ResponseEntity(CustomizeExceptionEnum customizeExceptionEnum, String resultMsg) {
        this.resultCode = customizeExceptionEnum.getResultCode();
        this.isSuccess = customizeExceptionEnum.getIsSuccess();
        this.resultMsg = resultMsg;
    }

}
